<%@ page import="com.pyrsana.faith.membership.User" %>
<!doctype html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'user.label', default: 'User')}" />
		<title><g:message code="default.create.label" args="[entityName]" /></title>
	</head>
	<body>
		<div class="content" role="main">
			<h1><g:message code="default.register.label" args="[entityName]" default="Register User" /></h1>
			<g:if test="${flash.message}">
			<div class="message" role="status">${flash.message}</div>
			</g:if>
			<g:hasErrors model="${[userInstance: userInstance, profile: userInstance.profile]}">
				<ul class="errors" role="alert">
					<g:eachError model="${[userInstance: userInstance, profile: userInstance.profile]}">
					<li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${it.field}"</g:if>><g:message error="${it}"/></li>
					</g:eachError>
				</ul>
			</g:hasErrors>
			<g:form action="save">
				<fieldset class="form">
					<g:render template="form"/>
					<g:render template="/profile/form" />
				</fieldset>
				<fieldset class="buttons center">
					<g:if test="${userInstance?.id == null}">
						<g:submitButton name="register" class="save" value="${message(code: 'default.button.register.label', default: 'Register')}" />
					</g:if>
					<g:else>
						<g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" />
						<g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" formnovalidate="" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
					</g:else>
				</fieldset>
			</g:form>
		</div>
	</body>
</html>
